<!doctype html>
<html>
<head>
	<meta charset="utf-8">
	<title>具名slot与匿名slot</title>
	<!--引入Vue库-->
	<script src="vue.js"></script>
</head>
<body>	
<div id="app">
  <parent></parent>
</div>
<script>
  var childNode = {
      template: `
      <div class="child">
          <p>子组件</p>
          <slot name="my-body">主体默认内容</slot>
      </div>
      `,
    };
  var parentNode = {
      template: `
      <div class="parent">
        <p>父组件</p>
        <child>
            <p slot="my-header">头部更新内容</p>
            <p slot="my-body">主体更新内容</p>
            <p>其他新增内容</p>
            <p slot="my-footer">尾部更新内容</p>
        </child>
      </div>
      `,
      components: {
        'child': childNode
      },
  };
  // 创建根实例
  var vm=new Vue({
      el: '#app',
      components: {
        'parent': parentNode
      }
  })
</script>
</body>
</html>
